package Task12;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int j = scanner.nextInt();
        int i = scanner.nextInt();
        System.out.println(binInsert(n, m, i, j));

    }
    public static int binInsert(int n, int m, int j, int i) {
        return n | (m << i);
    }
}
